<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateServerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('server', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->nullable()->comment('用户id');

            $table->string('name',10)->nullable()->comment('服务器名称');
            $table->string('domain',50)->nullable()->comment('服务器域名');

            $table->string('server_host',50)->nullable()->comment('服务器ip');
            $table->string('server_port',6)->nullable()->comment('服务器端口');

            $table->string('db_host',50)->nullable()->comment('数据库ip');
            $table->string('db_port',6)->nullable()->comment('数据库端口');

            $table->string('db_acc',15)->nullable()->comment('数据库acc');
            $table->string('db_pwd',25)->nullable()->comment('数据库pwd');

            $table->longText('info')->nullable()->comment('服务器介绍');
            $table->dateTime('endTime')->nullable()->comment('服务结束时间');

            $table->string('qq_server',20)->nullable()->comment('客服QQ');
            $table->string('qq_group',20)->nullable()->comment('QQ群');
            $table->tinyInteger('ratio')->default(0)->comment('分成比例%');

            $table->string('remark')->nullable()->comment('备注');

            $table->tinyInteger('order')->nullable()->comment('序号');
            $table->tinyInteger('state')->nullable()->comment('状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('server');
    }
}
